<template>
	<div class="admpersona">
		<div class="dd">
			<div class="d1">
				<div class="d2">
					<p class="p1">管理员设置</p>
					—
					<p>角色列表</p>
				</div>
				<div class="im">
					<el-button icon="el-icon-refresh-right"></el-button>
				</div>
			</div>
			<div class="hr"></div>
			<div class="d3">
				<el-button>添加角色</el-button>
			</div>
			<el-table :data="Alllist" class="d4" border>
				<el-table-column prop="id" label="序号"></el-table-column>
				<el-table-column prop="name" label="角色名称"></el-table-column>
				
				<el-table-column prop="account" label="操作员数量"></el-table-column>
				
				<el-table-column prop="value" label="状态">
					<template slot-scope="scope">
						<el-switch v-model="scope.row.value" active-color="#13ce66" inactive-color="#ff4949"
							@change="Status()" true-label="启用" false-label="禁止"></el-switch>
					</template>
				</el-table-column>
				<el-table-column label="管理">
					<template slot-scope="scope">
						<el-button type="primary" icon="el-icon-edit" @click="Edit(scope.row)">编辑</el-button>
						<el-button type="danger" class="d8" icon="el-icon-delete" @click="Delete(scope.row)">删除</el-button>
					</template>
				</el-table-column>
			</el-table>
		</div>
	</div>
</template>

<script>
	export default {
		name:'Admpersona',
		data() {
			return {
				Alllist: [],
			}
		},
		methods: {
			getHotBook() {
				const token = localStorage.getItem('token'); // 从本地存储获取 token  
		
				this.$axios.get("http://127.0.0.1/api/user/info", {
					headers: {
						'Authorization': `Bearer ${token}` // 将 token 添加到请求头中  
					}
				}).then((resp) => {
					resp.data.data.forEach((item) => {
						this.Alllist.push(item);
						console.log(this.Alllist);
					})
					console.log(this.Alllist)
				})
			},
		},
		mounted() {
			this.getHotBook();
		},
	}
</script>

<style scoped>
	.admpersona{
		width: 85%;
	}
	
	.admpersona .hr {
		margin-top: 1%;
		border: 1px solid #f4f4f4;
	}

	.dd {
		width: 95%;
		margin-left: 5%;
	}

	.d1 {
		display: flex;
		justify-content: space-between;
		margin-top: 2%;
	}

	.d1 .p1 {
		color: #a7adb2;
	}

	.d1 .im .el-button{
		background-color: #2da99d;
		color: white;
		border-radius: 5px;
	}

	.d2 {
		width: 17%;
		display: flex;
		justify-content: space-between;
	}

	.d3 button {
		margin-top: 1%;
		width: 9%;
		height: 35px;
		background-color: #009688;
		color: white;
		border-radius: 5%;
		border: none;
	}

	.d4 {
		margin-top: 2%;

	}

	.d6 {
		width: 20%;
		display: flex;
		margin-top: 1%;
	}

	.d6 .el-button {
		background-color: #009688;
		color: white;
		margin-left: 5%;
	}
</style>
